package com.cloudwise.thread;

import com.cloudwise.util.TreeUtil;

/**
 * @author ：Teacher陈
 * @date ：Created in 2021/1/5 11:20
 * @description：实现接口的方式
 * @modified By：
 * @version: 1
 */
public class ImplementsRunable  implements   Runnable {
    private String ip;

    public ImplementsRunable(String ip) {
        this.ip = ip;
    }

    @Override
    public void run() {
        TreeUtil.checkHost(ip);
    }


    public static void main(String[] args) {
        for (int i = 1; i <255 ; i++) {
            String ip="192.168.31."+i;
            //创建一个多线程对象
            ImplementsRunable implementsRunable= new ImplementsRunable(ip);
            //实现接口的多线程对象启动需要依赖thread类
            new  Thread(implementsRunable).start();

        }
    }
}
